package map.utils;

import android.content.Intent;

import com.baidu.mapapi.CoordType;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.model.LatLng;
import com.zjw.zy.utils.AppUtils;

import map.MapActivity;

public final class MapUtils {

    private static volatile boolean isInit = false;

    public static void init() {
        if (isInit) {
            return;
        }
        isInit = true;
        SDKInitializer.initialize(AppUtils.getApp());
        SDKInitializer.setCoordType(CoordType.BD09LL);
    }

    public static void startMap() {
        Intent intent = new Intent(AppUtils.getMainActivity(), MapActivity.class);

        AppUtils.getMainActivity().startActivity(intent);
    }

    public static void startMap(LatLng target) {
        Intent intent = new Intent(AppUtils.getMainActivity(), MapActivity.class);

        intent.putExtra(MapActivity.PARAMS_TARGET_LOCATION, target);
        AppUtils.getMainActivity().startActivity(intent);
    }
}
